package com.dts.controller;

import com.alibaba.fastjson.JSON;
import com.dts.entity.Hello;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/test")
public class TestController {

    @PostMapping(value = "/index" , produces = "text/json;charset=UTF-8")
    @ResponseBody
    public String index(@RequestBody Hello hello){
        System.out.println(hello.getUsername());
        return JSON.toJSONString(hello);
    }
}
